<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>选择入住城市</title>
    <link rel="stylesheet" href="../../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/iconfont/iconfont.css">
    <style>
        input[type="text"]{
            border: 1px solid #ccc;
            height:auto !important;
        }
    </style>
</head>
<body style="cursor: pointer">
    <div class="aui-content" id="map-container" style="width: 100%;height: 100%;">

    </div>
</body>
<script type="text/javascript" src="../../../script/extend/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="../../../script/aui/api.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script>
    apiready = function(){
        api.parseTapmode();
        //酒店信息
        let hotelDetail  = JSON.parse($api.getStorage("checked_room_detail"));
        //获取酒店名称
        let hotelName = hotelDetail.HotelName;
        //获取经度
        let longitude = hotelDetail.Longitude;
        console.log(longitude);
        //获取纬度
        let latitude = hotelDetail.Latitude;
        console.log(latitude);
        var map = api.require('bMap');
        //打开地图
        map.open({
            rect: {
                x: 0,
                y: 0,
                w: api.winWidth,
                h: api.pageParam.frameheight
            },
            center: {
                lon: longitude,
                lat: latitude
            },
            zoomLevel: 18,
            showUserLocation: true,
            fixedOn: api.frameName,
            fixed: true
        }, function(ret) {
            if (ret.status) {
                map.addAnnotations({
                  annotations: [{
                      id: 1,
                      lon: longitude,
                      lat: latitude
                  }],
                  draggable: true
                }, function(ret) {
                    // alert($api.jsonToStr(ret));
                    if (ret) {

                    }
                });
            }
        });

        //当用户滑动以后返回原始中心点
        // map.setCenter({
        //     coords: {
        //         lon: '121.322679',
        //         lat: '31.141678'
        //     },
        //     animation: false
        // });
    }
</script>
</html>
